<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input id="input" type="number" min="100" max="300" required/>
		<button onclick="p2()">点击验证</button>
		<p id="p"></p>
		
		<script>
			function p1(){
				var input1 = document.getElementById("input");
				if(input1.checkValidity()==false){
					document.getElementById("p").innerHTML = input1.validationMessage;
				}
			}
			
			function p2(){
				var input1 = document.getElementById("input");
				if(input1.validity.rangeOverflow){
					document.getElementById("p").innerHTML = "输入的值太大了";
				}else if(input1.validity.rangeUnderflow){
					document.getElementById("p").innerHTML = "输入的值太小了";
				}
			}
		</script>
	</body>
</html>